import axios from "axios";

//获取列表
export function fetchgetList(params) {
  return axios({
    url: "http://localhost:3001/data",
    method: "get",
    params,
  });
}

//新增
export function fetchAddTask(data) {
  return axios({
    url: "http://localhost:3001/data",
    method: "post",
    data,
  });
}

//编辑
export function fetchEditTask(data) {
  return axios({
    url: `http://localhost:3001/data/${data.id}`,
    method: "put",
    data,
  });
}

//详情
export function fetchDetailTask(id) {
  return axios({
    url: `http://localhost:3001/data/${id}`,
    method: "get",
  });
}

//删除
export function fetchDelTask(id) {
  return axios({
    url: `http://localhost:3001/data/${id}`,
    method: "delete",
  });
}

//搜索
export function fetchSearchTask(value) {
  return axios({
    url: `http://localhost:3001/data/?name=${value}`,
    method: "get",
  });
}
